package com.mr.web.app;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.ui.ModelMap;

import com.mr.biz.CategoryRepository;
import com.mr.biz.support.Response;
import com.mr.utils.JacksonUtils;
import com.mr.web.support.AbstractApp;

@Component
public class CategoryApp extends AbstractApp {

	@Resource
	private CategoryRepository categoryRepository;

	public void load(ModelMap model) throws Exception {
		Response response = categoryRepository.load();
		model.addAttribute("categories", JacksonUtils.readFromStr(response.getJsonData()));
	}
}
